import React from 'react'
import { createStackNavigator } from '@react-navigation/stack'
import HomeScreen from '../screens/Home'
import { Alert, Text, TouchableOpacity } from 'react-native'

const Stack = createStackNavigator()

function HomeStack(): React.JSX.Element {
  return (
    <Stack.Navigator
      initialRouteName="Home"
      screenOptions={{ headerMode: 'screen' }}>
      <Stack.Screen
        name="HomeStack"
        component={HomeScreen}
        options={{
          title: '首页',
          headerStyle: {
            backgroundColor: 'tomato',
          },
          headerRight: () => (
            <TouchableOpacity onPress={() => Alert.alert('Hello')}>
              <Text>Hello</Text>
            </TouchableOpacity>
          ),
        }}
      />
    </Stack.Navigator>
  )
}

export default HomeStack
